<template>
    <el-table :data="tableData" v-loading="logTableLoading" border style="width: 100%">
        <el-table-column align="center" prop="username" label="登录账号" />
        <el-table-column align="center" prop="lastLogin.ip" label="上次登录ip" />
        <el-table-column align="center" sortable prop="lastLogin.loginTime" label="上次登录时间" />
        <el-table-column align="center" prop="nowLogin.ip" label="本次登录ip" />
        <el-table-column align="center" sortable prop="nowLogin.loginTime" label="本次登录时间" />

    </el-table>
</template>

<script setup>
import { ref, onMounted } from 'vue'
// 引入登入日志
import { getLoginLogApi } from '@/api/users.js'
const tableData = ref([])
const logTableLoading = ref(false)
// 封装获取登入日志的方法
let getLoginLog = async () => {
    logTableLoading.value = true
    try {
        const res = await getLoginLogApi()
        // console.log(res);
        tableData.value = res.data.data
        logTableLoading.value = false
    } catch (e) {
        console.log(e);
        logTableLoading.value = false
    }
}


onMounted(async () => {
    getLoginLog()
})
</script>

